<?php $this->widget('CAutoComplete',
          array(
                         //name of the html field that will be generated
             'name'=>'user_name',
                         //replace controller/action with real ids
             'url'=>array("site/autoCompleteLookup"),
             'max'=>10, //specifies the max number of items to display

                         //specifies the number of chars that must be entered
                         //before autocomplete initiates a lookup
             'minChars'=>2,
             'delay'=>500, //number of milliseconds before lookup occurs
             'matchCase'=>false, //match case when performing a lookup?

                         //any additional html attributes that go inside of
                         //the input field can be defined here
             'htmlOptions'=>array('size'=>'40'),

             'methodChain'=>".result(function(event,item){\$('#user_id').val(item[1]);})",
             ));
    ?>
    <?php echo CHtml::hiddenField('user_id'); ?>